package com.example.prison.mapper;

import com.example.prison.entity.SystemLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author jiang
* @description 针对表【system_log】的数据库操作Mapper
* @createDate 2023-06-12 15:57:49
* @Entity com.example.prison.entity.SystemLog
*/
@Mapper
public interface SystemLogMapper extends BaseMapper<SystemLog> {

    @Select("select * from system_log order by id desc")
    List<SystemLog> get();

    @Insert("insert into system_log(function, operation_time, operator) " +
            "values (#{function}, #{operationTime}, #{operator})")
    int add(SystemLog log);

    @Select("select * from system_log where operation_time between #{beginTime} and #{endTime} order by id desc")
    List<SystemLog> getByTime(@Param("beginTime") String beginTime, @Param("endTime") String endTime);

    @Select("select * from system_log where operator=#{operator} order by id desc")
    List<SystemLog> getByOperator(@Param("operator") String operator);

    @Select("select * from system_log where id=#{id}")
    SystemLog getById(@Param("id") Integer id);

}




